package com.shy.configs.converts;

import com.shy.collect.entity.PayProduct;
import com.shy.configs.mvc.models.vo.DicItemVo;
import com.shy.configs.mvc.models.vo.PayProductVo;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.MappingConstants;
import org.mapstruct.Mappings;

import java.util.List;

@Mapper(componentModel = MappingConstants.ComponentModel.SPRING, uses = {ConvertHelper.class})
public interface ProductConvert {

    List<DicItemVo> convertListDicItemVo(List<PayProduct> productList);

    List<PayProductVo> convertListPayProductVo(List<PayProduct> productList);

    @Mappings({
            @Mapping(source = "editTime", target = "editTime", dateFormat = "yyyy-MM-dd HH:mm:ss"),
            @Mapping(source = "status", target = "status", qualifiedByName = "transStatus")

    })
    PayProductVo mapPayProductVo(PayProduct product);


    @Mappings({
            @Mapping(source = "productCode", target = "code"),
            @Mapping(source = "productName", target = "label")
    })
    DicItemVo mapDicItemVo(PayProduct product);
}